import pymysql

if __name__ == '__main__':
    conn = pymysql.connections.Connection(host="127.0.0.1",user="root",password="root",port=3306,db="test",charset="utf8")
    cursor = conn.cursor()
    sql = "insert into depts values (1004,'后勤部')"
    cursor.execute(sql)

    conn.commit()
    cursor.close()
    conn.close()
